from utils.drawUtils import *

# 相同分布相同大小
# file_path = "./ddss/2024_09_21_09_54_43/acc_records.json"
file_path = "./ddss2/2024_09_30_19_49_39/acc_records.json"
# file_path = "./nfss/2024_09_26_16_08_00/acc_records.json"
# file_path = "./nfss2/2024_09_30_19_49_39/acc_records.json"
# file_path = "./nlss/2024_09_30_10_09_51/acc_records.json"
# file_path = "./nlss2/2024_09_29_18_06_26/acc_records.json"
# file_path = "./sdss/2024_09_22_11_00_18/acc_records.json"
# file_path = "./sdss2/2024_10_01_08_20_39/acc_records.json"
# file_path = "./sdds2/2024_09_30_19_50_02/acc_records.json"

json_obj = paresJsonObject(file_path)
epoch_com_acc_list = json_obj["epoch_com_acc_list"]

# last_acc_json_obj = json_obj["epoch_com_acc_list"][-1]
final_contribution = [0.0 for i in range(5)]
epoch_contribution = []
for epoch in range(1, len(epoch_com_acc_list)):
    contributions = calClientsContributionMR(5, epoch_com_acc_list[epoch])
    final_contribution = addList(final_contribution, contributions)
    epoch_contribution.append(contributions)

percentage = percentageOfTotal(final_contribution)

percentage2 = calPercentageOfClient(epoch_contribution, 0.9999999999)
print(f"contributions={final_contribution}")
print(f"percentage={percentage}")
print(f"percentage2={percentage2}")